import { EChartOption } from 'echarts';

type PieDataType = number[] | number[][] | EChartOption.SeriesPie.DataObject[];

export const getSimpleOption = () => ({
  tooltip: {
    trigger: 'item',
    formatter: '{b} : {c} ({d}%)',
  },
  color: [
    '#5470c6',
    '#91cc75',
    '#fac858',
    '#ee6666',
    '#73c0de',
    '#3ba272',
    '#fc8452',
    '#9a60b4',
    '#ea7ccc',
  ],
  series: [
    {
      type: 'pie',
      radius: '60%',
      labelLine: {
        normal: {
          length: 5,
        },
      },
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)',
        },
      },
      label: {
        normal: {
          show: true,
          formatter: '{b}:\n {c}({d}%)', //自定义显示格式(b:name, c:value, d:百分比)
          padding: [0, -10],
          rich: {
            a: {
              fontSize: 10,
              padding: [0, 0, 5, 0],
            },
            b: {
              fontSize: 10,
              margin: [0, 0, 10, 0],
            },
          },
        },
      },
      data: [] as PieDataType,
    },
  ] as EChartOption.SeriesPie[],
});
